using System;

namespace DecisionMaking.BusinessLogic
{
	
	public class DuplicateEmailException : Exception
	{
		public DuplicateEmailException(string email, Exception cause) : base(null, cause)
		{
			base.Data.Add("email", email);
		}
	}
	
	public class DuplicateEnvironmentNameException : Exception
	{
		public DuplicateEnvironmentNameException(string name, Exception cause) : base(null, cause)
		{
			base.Data.Add("name", name);
		}
	}
	
	public class DuplicateCueAttributeNameException : Exception
	{
		public DuplicateCueAttributeNameException(string name, Exception cause) : base(null, cause) 
		{
			base.Data.Add("name", name);
		}
	}	
	
	public class DuplicateCueNameException : Exception
	{
		public DuplicateCueNameException(string name, Exception cause) : base(null, cause) 
		{
			base.Data.Add("name", name);
		}
	}	
	
	public class DuplicateCandidateNameException : Exception
	{
		public DuplicateCandidateNameException(string name, Exception cause) : base(null, cause) 
		{
			base.Data.Add("name", name);
		}
	}
	
	public class AccountNotFoundException : Exception
	{
		public AccountNotFoundException(string email) : base(string.Format("Account with email {0} was not found", email)) 
		{
			base.Data.Add("email", email);
		}		
	}
	
	public class AccessDeniedException : Exception
	{
		public AccessDeniedException(int accountId, Type type, Object objectId) 
			: base(string.Format("Account with id {0} doesn't have access to {1} with id {2}", accountId, type, objectId)) 
		{
			base.Data.Add("accountId", accountId);
			base.Data.Add("type", type);
			base.Data.Add("objectId", objectId);
		}	
	}
	
	public class EntityNotFoundException : Exception
	{
		public EntityNotFoundException(Type type, Object id, Exception cause) : base(string.Format("{0} with id {1} was not found", type, id), cause) 
		{
			base.Data.Add("type", type);
			base.Data.Add("id", id);
		}		
	}	

    public class InvalidCueValueException : Exception
    {
        public InvalidCueValueException(int row, int col, Exception cause) : base(string.Format("Error parsing numeric value at row {0} column {1}", row, col), cause)
        {
            base.Data.Add("row", row);
            base.Data.Add("col", col);
        }
    }

    public class AlgorithmCompilationException : Exception
    {
        public AlgorithmCompilationException(string errors) : base("Algorithm failed to compile", null)
        {
            base.Data.Add("errors", errors);
        }        
    }

    public class AlgorithmExecutionException : Exception
    {
        public AlgorithmExecutionException(string message, Exception cause) : base(message, cause)
        {
        }
    }

    public class NoSuchAlgorithmEngineException : Exception
    {
        public NoSuchAlgorithmEngineException(string engine) : base(string.Format("No such IAlgorithm class: {0}", engine), null)
        {
            base.Data.Add("engine", engine);
        }
    }

    public class DuplicateAlgorithmDefinitionNameException : Exception
    {
        public DuplicateAlgorithmDefinitionNameException(string name, Exception cause)
            : base(null, cause)
        {
            base.Data.Add("name", name);
        }
    }
}
